<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<title>测试客户端</title>
</head>
<body>
	<form id="clientForm">
		连接:<br><input name="url" style="width:800px;"><br>
		请求数据（JSON）:<br><textarea rows="10" cols="100" name="senddata"></textarea><br>
		接收数据:<br><textarea rows="20" cols="100" name="recdata"></textarea><br><br>
		<input value="提交数据" type="button" id="MyBtn">
	</form>
	
	<script type="text/javascript">
		$(document).ready(function(){
			$("#MyBtn").click(function(){
				var data = JSON.parse($("textarea[name=senddata]").val());
				$.ajax({
					url : $("input[name=url]").val(),
					type : 'POST',
					data : data,
					cache : false,
					success:function(d){
						$("textarea[name=recdata]").val(JSON.stringify(d,null,'\t'));
					}
				});
			});
		});
	</script>
</body>
</html>